/*
 * strategy.h
 *
 *  Created on: Apr 24, 2014
 *      Author: zby
 *--------------------------------------------------------------
 *  Strategy design pattern is used when you want to applay different
 *  algorithm (for your class) to fulfill different situactions.
 *  For example:
 *  You have
 *
 */

#ifndef STRATEGY_H_
#define STRATEGY_H_

namespace strate
{
//--------------------------------------------------
    class Figure{
        public:
            static const int len;
            virtual int field()=0;
            virtual ~Figure(){};
    };

    class Square : public Figure{
        private:
            static Square * psquare;
            Square(){};
            Square(Square &){};
            Square& operator=(Square const&){};
        public:
            ~Square();
            static Square * getSingleton();
            int field();
    };

    class Triangle : public Figure{
        private:
            static Triangle * ptriangle;
            Triangle(){};
            Triangle(Triangle &){};
            Triangle& operator=(Triangle const&){};
        public:
            ~Triangle();
            static Triangle * getSingleton();
            int field();
    };

    class Round : public Figure{
        private:
            static Round * pround;
            Round(){};
            Round(Round &){};
            Round& operator=(Round const&){};
        public:
            ~Round();
            static Round * getSingleton();
            int field();
    };
//--------------------------------------------------
    class Strategy {
        private:
            Figure * pfig;
        public:
            virtual ~Strategy();
            void set_figure(Figure * pfigr);
            int show_field();
    };
}

#endif /* STRATEGY_H_ */
